/**
 * 文件描述：基础路由表
 */

import type { RouteRecordRaw } from "vue-router";

const routes: RouteRecordRaw[] = [
  // 首页
  {
    path: "/",
    name: "Home",
    component: () => import("@/layouts/DefaultLayout.vue"),
    // 重定向到数据看板
    redirect: "/dashboard",
    children: [
      // 数据看板
      {
        path: "/dashboard",
        name: "DashBoard",
        component: () => import("@/views/dashboard/DashBoard.vue"),
      },
      // 充电站管理 - 充电站监控
      {
        path: "/chargingstation/monitor",
        name: "Monitor",
        component: () => import("@/views/chargingstation/Monitor.vue"),
      },
      // 充电站管理 - 营收统计
      {
        path: "/chargingstation/revenue",
        name: "Revenue",
        component: () => import("@/views/chargingstation/Revenue.vue"),
      },
      // 充电站管理 - 充电桩管理
      {
        path: "/chargingstation/fault",
        name: "Fault",
        component: () => import("@/views/chargingstation/Fault.vue"),
      },
      // 电子地图
      {
        path: "/map",
        name: "map",
        component: () => import("@/views/Map/ElectronicMap.vue"),
      },
      // 运营管理 - 订单管理 -- 考虑订单详情页返回管理页面,需要缓存,所以加上 keepAlive
      {
        path: "/operations/orders",
        name: "Orders",
        component: () => import("@/views/operations/Orders.vue"),
        meta: { keepAlive: true },
      },
      // 运营管理 - 订单详情
      {
        path: "/operations/detail",
        name: "Detail",
        component: () => import("@/views/operations/Detail.vue"),
      },
      // 运营管理 - 计费管理
      {
        path: "/operations/total",
        name: "Total",
        component: () => import("@/views/operations/Total.vue"),
      },
      // 报警管理
      {
        path: "/alarm",
        name: "Alarm",
        component: () => import("@/views/alarm/Alarm.vue"),
      },
      // 会员卡管理
      {
        path: "/equipment",
        name: "Equipment",
        component: () => import("@/views/equipment/Equipment.vue"),
      },
      // 招商管理
      {
        path: "/document",
        name: "Document",
        component: () => import("@/views/document/Document.vue"),
        meta: {
          needAuth: ["admin", "manager"],
        },
      },
      // 系统设置
      {
        path: "/system",
        name: "System",
        component: () => import("@/views/system/System.vue"),
        meta: {
          needAuth: ["admin", "manager"],
        },
      },
      // 个人中心
      {
        path: "/personal",
        name: "Personal",
        component: () => import("@/views/personal/Personal.vue"),
      },
    ],
  },
  //   登录
  {
    path: "/login",
    name: "Login",
    component: () => import("@/views/login.vue"),
  },

  //   404
  {
    path: "/:pathMatch(.*)*",
    name: "NotFound",
    component: () => import("@/views/NotFound.vue"),
  },
];

export default routes;
